package com.woniuxy.mapper;

import com.work.framework.pojo.Auction;
import com.work.framework.pojo.Balance;
import com.work.framework.pojo.Goods;
import com.work.framework.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

/**
 * @author Administrator
 * @title: MoneyMapper
 * @projectName mashangpai
 * @description: TODO
 * @date 2019/9/1916:22
 */
@Mapper
@Repository
public interface MoneyMapper {
    /**
     * 用户余额查询
     *
     * @param uid
     * @return
     */
    @Select("select * from balance where uid =#{uid}")
    Balance findBalance(Integer uid);

    /**
     * 用户余额修改
     *
     * @param id
     * @param money
     * @return
     */
    @Update("update balance set amount = #{money} where id =#{id}")
    Integer updateMoney(Integer id, BigDecimal money);

    @Select("select * from `order` where oid = #{oid}")
    Order findOrder(Integer oid);

    @Select("select * from auction where gid = #{gid} and valid = 1")
    Auction findAuctionById(Integer gid);
}
